<template>
    <div>
        <el-input  v-model="search_UID" placeholder="会员UID"></el-input>
        <el-input v-model="search_name" placeholder="会员昵称"></el-input>
         <el-select v-model="search_type" placeholder="请选择" @change="getRecord">
         <el-option
             v-for="item in options"
             :key="item.value"
             :label="item.label"
             :value="item.value">
             </el-option>
         </el-select>
          <el-date-picker
             v-model="searchTime"
             type="date"
             placeholder="选择日期"
             format="yyyy - MM - dd"
             value-format="yyyy-MM-dd">
           </el-date-picker>
            <button class="sousuo" @click="search"><i class="el-icon-search"></i></button>
        <template>
            <el-table v-loading="loading" :data="yuEDate" border style="width: 100%">
                <el-table-column prop="date" label="用户信息">
                    <template v-slot="scope">
                        <div class="head_url">
                            <img :src="scope.row.head_url" alt="">
                        </div>
                        <div class="info">
                            <div class="uid">UID: <span>{{scope.row.uid}}</span></div>
                            <div class="nickname">{{ scope.row.name }}</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="充值余额">
                    <template v-slot="scope">
                        ￥{{ format_money(scope.row.total_fee) }}
                    </template>
                </el-table-column>
                <el-table-column prop="address" label="充值方式">
                    <template v-slot='scope'>
                        <el-button v-if="scope.row.type==1" size="mini" round type="success">人工充值</el-button>
                        <el-button v-else size="mini" round type="success">后台充值</el-button>
                    </template>
                </el-table-column>
                <el-table-column prop="date" label="充值时间">
                </el-table-column>
                <el-table-column prop="out_trade_no" label="订单号">
                </el-table-column>
                <el-table-column prop="manager" label="经办信息">
                </el-table-column>
            </el-table>
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pagenum"
                    :page-sizes="[8, 10, 15]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="total">
            </el-pagination>
        </template>
    </div>
</template>

<script>
import record from '../../../api/jurisdiction'
import {format_money} from "@/utils/format";
export default {
    data() {
        return {
            yuEDate: [],
            search_UID:null,
            search_name: null,
            searchTime:null,
            search_type:null,
            options: [
                {
                value: null,
                label: '请选择'
                },
                {
                value: '1',
                label: '人工充值'
                },
                {
                value: '2',
                label: '后台充值'
                }
                ],
            loading:true,
            pagesize: 8,
            pagenum: 1,
            total:0
        }
    },
    created() {
        this.getRecord()
    },
    methods: {
      format_money,
           search() {
            console.log(this.search_type)
            console.log(this.searchTime)
            console.log(this.search_UID)
            console.log(this.search_name)
            this.getRecord()
        },
        getRecord() {
            record.yuechongzhi({page:this.pagenum,page_size:this.pagesize,date:this.searchTime,type: this.search_type,uid:this.search_UID,name:this.search_name}).then((res) => {
                console.log('余额充值记录', res)
                this.yuEDate = res.data.data.list
                this.total = res.data.data.sum_count
                this.loading=false
            })
        },
        handleSizeChange(val) {
        this.pagesize = val
        this.getRecord()
        },
        handleCurrentChange(val) {
            this.pagenum = val
            this.getRecord()
        }
    },
}
</script>

<style lang="less" scoped>
.el-input {
    width: 250px;
    margin-right: 20px;
    margin-bottom: 30px;
}

.sousuo {
    margin: 6px;
    width: 50px;
    height: 40px;
    background: #009688;
    border: 0;
    color: white;
    font-size: 20px;
    vertical-align: middle;
    text-align: center;
    line-height: 40px;
    border-radius: 4px;
    cursor: pointer;
}
.head_url{
    float: left;
    width: 50px;
    height: 50px;
}
.head_url img{
    width: 100%;
    height: 100%;
}
.info{
    float: left;
    width:120px;
    height: 100%;
    margin-left:10px;
}
.uid{
    color:red;
    font-size: 12px;
}
.el-pagination{
    text-align: center;
    margin-top:20px;
}
.el-date-picker{
    margin-left:6px;
}
.el-select{
    margin-right: 20px;
}
</style>